Skip to content

Conversation

@rpothin
Copy link
Owner

@rpothin rpothin commented Jan 28, 2026

Problem

After ✔ 🎉 All 11 tasks completed successfully! appears, there was a noticeable long delay (sometimes several seconds) before terminal control returned to the user, slowing down the workflow.

Root Cause

The run command was starting iteration checkpoint commits asynchronously via the iterationEnd event handler without awaiting them. These git operations (invoking hooks, LFS, commit signing, auto-push) could continue running after the final success message was printed, keeping the Node.js event loop alive and delaying process.exit().

Solution

  • Serialized checkpoint commits into a queue (checkpointQueue: Promise<void>) to
    eliminate concurrency issues
  • Moved the flush point to immediately after await engine.start(activeTask)
    completes
  • Now the CLI awaits all pending checkpoint work before stopping spinners and
    printing final output
  • This ensures:
    • Checkpoints still complete (maintaining safety guarantees)
    • Process can exit immediately after success message
    • No visible delay to the user

Changes

Code

  • src/commands/run.ts:
    • Added checkpointQueue promise chain for serialized checkpoint creation
    • Replaced fire-and-forget pattern with .then(async () => {...})
    • Added await checkpointQueue right after task completion to flush before final
      output

Documentation

  • README.mdTroubleshooting section:
    • New entry: "Long delay before returning to prompt"
    • Explains that git hooks, LFS, commit signing, and auto-push can add latency
    • Lists mitigations:
  • Disable checkpoints: autoCommit: false
  • Disable auto-push: autoPush: false / pushStrategy: manual
  • Inspect/disable slow hooks in .git/hooks/

Version

  • Bumped package.json version from 0.1.40.1.5
  • Added JOURNAL entry documenting the change

Testing

✅ All 311 tests pass
✅ Linting passes
✅ TypeScript compilation successful
✅ Build successful

Impact

  • Behavioral: Users now see immediate control return after completion
  • Safety: No change—checkpoints still complete before exit
  • Performance: Eliminates perceived delay without changing CLI behavior
  • Breaking: None

Related Issue

Resolves long delays reported when running multi-task workflows with git-intensive environments (Husky hooks, LFS, commit signing enabled).

- Serialize iteration checkpoint commits into a queue to ensure they complete before final output
- Await checkpoint queue immediately after engine.start() to flush pending git work
- This prevents long post-success delays caused by slow git hooks, LFS, signing, or auto-push

The CLI now returns control to the user immediately after the success message, while still
ensuring all checkpoint commits are completed before exit.

BREAKING: None. This is a behavioral improvement that eliminates delay without changing the
checkpoint guarantee model.

Documentation:
- Added 'Long delay before returning to prompt' troubleshooting section in README
- Explains causes (git hooks, LFS, signing) and mitigations (disable checkpoints/push)

Bumps version to 0.1.5
@rpothin rpothin self-assigned this Jan 28, 2026
@rpothin rpothin added bug Something isn't working documentation Improvements or additions to documentation labels Jan 28, 2026 — with GitHub Codespaces
@rpothin rpothin merged commit 5ceefcf into main Jan 28, 2026
10 checks passed
@rpothin rpothin deleted the fix-delay-post-run-before-closing branch January 28, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant